home *** CD-ROM | disk | FTP | other *** search
- Path: colossus.holonet.net!russell
- From: russell@news.mdli.com (Russell Blackadar)
- Newsgroups: comp.lang.c++
- Subject: Re: Q:order of evaluation
- Date: 27 Jan 1996 02:21:53 GMT
- Organization: HoloNet National Internet Access System: 510-704-1058/modem
- Message-ID: <4ec281$ctb@colossus.holonet.net>
- References: <4dfhlu$a33$1@mhafn.production.compuserve.com> <hamilton-1801962045570001@dialup-147.austin.io.com> <4dpcfo$293@clarknet.clark.net> <hamilton-2401960104020001@dialup-86.austin.io.com> <3108c867.40236096@nntp.ix.netcom.com> <4eb6kq$ksf@gazette.tandem.com>
- NNTP-Posting-Host: jubal.mdli.com
- X-Newsreader: TIN [version 1.2 PL2]
-
- yun_yeogirl (yyg) wrote:
- : Michael M Rubenstein wrote :
-
- : [Example:
- : i = v[i++]; // the behavior is undefined
- : i = 7,i++,i++; // `i' becomes 9
-
- : i = ++i + 1; // the behavior is undefined
- : i = i + 1; // the value of 'i' is incremented
-
- : The first and third statement seem clear to me. I don't see why they are
- : undefined.
-
- Read the previous post again, carefully. Both these statements modify
- i twice with no intervening sequence point, and that is always undefined.
- (The rule is actually stronger, as others have pointed out, but double
- modification is an easy thing to look for here.) It doesn't matter that
- they look clear to you; they will look unclear to the compiler! One simply
- has to get used to this.
-
- : I guess you made a typo here. Maybe you meant :
-
- : i + v[i++] and i + (++i + 1).
-
- Those would also be undefined, of course.
- --
- Russell Blackadar, russell@mdli.com
-